#!/bin/sh  

APP_NAME="EMOBILE GL06P Setting Tool.app"
USERPDF="EMOBILE GL06P usermanual.pdf"

cd ~/Desktop/
if [ -e "${USERPDF}" ]
then
sudo rm -rf ~/Desktop/"${USERPDF}"
fi

if [ -e "/Applications/${USERPDF}" ]
then
sudo ln -s "/Applications/${USERPDF}" ~/Desktop/"${USERPDF}"
fi

if ! defaults read $HOME/Library/Preferences/com.apple.dock persistent-apps | grep "$APP_NAME"; then
sudo -u $USER defaults write $HOME/Library/Preferences/com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/$APP_NAME</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
sudo killall Dock
fi